package com.jmxcfc.blfsc.cfca.common;

import org.apache.commons.lang3.StringUtils;

import java.util.UUID;

/**
 * 32 bit Uuid generator
 */
public final class UuidGenerator {

    private UuidGenerator() {
    }

    /**
     * get 32bit lower case uuid
     * @return
     */
    public static String uuid() {
        return StringUtils.replace(UUID.randomUUID().toString(), "-", "");
    }

    /**
     * 指定位数的UUID
     * @param len
     * @return
     */
    public static  String getUUID(int len)
    {
        if(len<=0)
        {
            return null;
        }
        return  StringUtils.replace(UUID.randomUUID().toString(), "-", "").substring(0, len);
    }
}
